#!/bin/bash
#
#       /etc/rc.d/init.d/extagentd
#
# Starts the extagent daemon
#
# chkconfig: 345 60 40
# description: Run all Extending Agents
# processname: extagentd


# Source function library
. /etc/rc.d/init.d/functions

# Pull in extagentd settings
[ -f /etc/sysconfig/extagentd ] && . /etc/sysconfig/extagentd


# Program name
PROGNAME="/usr/bin/extagentd"


RETVAL=0


start() {
	echo -n $"Starting extagent daemon: "

	TEMP=`pidofproc $PROGNAME`
	RUNNING=$?
	if [ $RUNNING -ne 0 ]; then
		daemon "$PROGNAME --config $CONFIG --background >>$LOG_FILE 2>&1"
		RETVAL=$?
	else
		failure
		RETVAL=1
	fi
	echo
	return $RETVAL
}


stop() {
	echo -n $"Stopping extagent daemon: "
	killproc $PROGNAME
	RETVAL=$?
	echo
	return $RETVAL
}


restart() {
	stop
	start
}


case "$1" in
start)
	start
	;;
stop)
	stop
	;;
restart)
	restart
	;;
status)
        status $PROGNAME
        RETVAL=$?
        ;;
*)
        echo $"Usage: $0 {start|stop|status|restart}"
        RETVAL=2
esac


exit $RETVAL
